<template>
  <div class="statics-org">
    <div class="statics-org-main">
      <StaticsOneRight1
        ref="right1"
        :startDate="selectOne.startDate"
        :endDate="selectOne.endDate"
        @cutPage="cutPage"
        :workTime="workTime"
        v-if="showOne" />
      <StaticsGatherMan :showAll="showAll" @cutPage="cutPage" :workTime="workTime" v-else />
    </div>
  </div>
</template>

<script>
import moment from 'moment'
import StaticsGatherMan from './StaticsGatherMan'
import StaticsOneRight1 from './StaticsOneRight1New'
import { getAttendanceRoleAndStandard } from '@apis/api-attendance.js'
moment.locale('zh-cn')
export default {
  components: {
    StaticsGatherMan,
    StaticsOneRight1,
  },
  props: {
    showAll: {
      type: String,
      default: '',
    },
    showType: {
      type: String,
      default: '1',
    },
  },
  data() {
    return {
      moment: moment,
      selectOne: {
        startDate: moment().startOf('month').format('YYYY-MM-DD'),
        endDate: moment().endOf('month').format('YYYY-MM-DD'),
      },
      showOne: true,
      workTime: {
        attendanceRole: '',
        attendanceStandard: '',
      },
    }
  },
  created() {},
  mounted() {
    this.getAttendanceRoleAndStandard()
  },
  methods: {
    cutPage(data) {
      this.showOne = data === '0'
    },
    getAttendanceRoleAndStandard() {
      getAttendanceRoleAndStandard({}).then(res => {
        this.workTime = res.data
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.statics-org {
  height: 100%;
  font-size: 14px;
  width: 100%;
  .statics-work-tips {
    color: #999999;
  }
  .statics-org-main {
    height: calc(100%);
    background-color: #fff;
  }
}
</style>
